feat(nextjs): move to a session cookie to give the ability to do route level scope based authorization#104
Merged
brionmario merged 4 commits intoasgardeo:mainfrom Jul 11, 2025
Conversation
pavinduLakshan
approved these changes
Jul 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request introduces a comprehensive logging utility and updates session management functionality across multiple packages. The most significant changes include adding a universal logger utility, enhancing session validation and management, and improving error handling in session-dependent methods.
Logging Utility Enhancements:
docs/developer/LOGGER.mdoutlining features, usage examples, and real-world applications for the new logging utility.packages/javascript/src/index.ts, includinglogger,createLogger,createComponentLogger, andLogLevel.packages/javascript/src/utils/__tests__/logger.test.tsto verify logging behavior, log levels, and custom configurations.Session Management Enhancements:
packages/nextjs/src/middleware/asgardeoMiddleware.tsto support JWT-based sessions alongside legacy session formats. Deprecated the legacy session validation function. [1] [2]packages/nextjs/src/server/AsgardeoProvider.tsxto prioritize JWT-based session payloads for authentication and organization handling, with fallbacks for legacy session IDs. [1] [2]Error Handling Improvements:
packages/nextjs/src/AsgardeoNextClient.tsto reject requests without a session ID and propagate errors during token retrieval.packages/nextjs/src/server/actions/getMyOrganizations.tsto validate session ID and access token availability before proceeding with organization data retrieval.Dependency Updates:
joseLibrary: Included thejoselibrary inpackages/nextjs/package.jsonto support JWT operations.Related Issues
@asgardeo/react&@asgardeo/nextjs#81Related PRs
Checklist
Security checks